import request from "@/utils/request";
import Dict from '@/enum/index.js'
import { getBaseMeal } from "@/views/account/helper/meal.js"
const concactMeal = getBaseMeal()


const routes = concactMeal.map(v => {
  return {
    name: "IndexShare" + v.type,
    path: "index/share" + v.type,
    hidden: false,
    component: "account/index",
    meta: {
      title: v.name,
      icon: "user",
      noCache: false,
      link: null,
      type: v.type,
    },
  }
})
// 获取路由
export const getRouters = () => {
  // return request({
  //   url: '/getRouters',
  //   method: 'get'
  // })
  return new Promise((resolve) => {
    resolve({
      msg: "操作成功",
      code: 200,
      data: [
        {
          name: "Account",
          path: "/account",
          hidden: false,
          redirect: "noRedirect",
          component: "Layout",
          alwaysShow: true,
          meta: {
            title: "账号管理",
            icon: "system",
            noCache: false,
            link: null,
          },
          children: [
            {
              name: "Index",
              path: "index",
              hidden: false,
              component: "account/index",
              meta: {
                title: "用户管理",
                icon: "user",
                noCache: false,
                link: null,
              },
            },
            {
              name: "Pool",
              path: "pool",
              hidden: false,
              component: "pool/index",
              meta: {
                title: "账号池管理",
                icon: "user",
                noCache: false,
                link: null,
              },
            },
            {
              name: "Consumption",
              path: "consumption",
              hidden: false,
              component: "consumption/index",
              meta: {
                title: "续费码管理",
                icon: "user",
                noCache: false,
                link: null,
              },
            },
            ...routes
          ],
        },
      ],
    });
  });
};
